﻿/* Copyright (C) 2006,2007 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#include "../sc_defines.h"
#include "../../../../game/Item.h"
#include "../../../../game/Player.h"
#include "../../../../game/SpellAuras.h"
#include "../../../../game/GossipDef.h"
#include "../../../../game/Chat.h"
bool GossipHello_ItemUse_flying_mount(Player *player, Item* _Item, SpellCastTargets const& targets)
{
	player->CLOSE_GOSSIP_MENU();
	if (!player->isDead() && !player->isInCombat())
	{
		if(player->GetMapId()==1 || player->GetMapId()==0){
	          player->ADD_GOSSIP_ITEM( 1, "【深圳达人坐骑】", 1, GOSSIP_ACTION_INFO_DEF + 10);
	          player->ADD_GOSSIP_ITEM( 8, "【普通陆地坐骑】" , 1, GOSSIP_ACTION_INFO_DEF + 1);
              player->ADD_GOSSIP_ITEM( 4, "【高级陆地坐骑】"        , 1, GOSSIP_ACTION_INFO_DEF + 2);
              player->ADD_GOSSIP_ITEM( 4, "【特殊奇怪坐骑】"       , 1, GOSSIP_ACTION_INFO_DEF + 3);
              player->ADD_GOSSIP_ITEM( 4, "【高级飞行坐骑】"       , 1, GOSSIP_ACTION_INFO_DEF + 4);
	          player->ADD_GOSSIP_ITEM( 4, "【特殊最新坐骑】"     , 1, GOSSIP_ACTION_INFO_DEF + 5);
	          player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
	       return true;
	       }
		else{
			 player->GetSession()->SendAreaTriggerMessage(" 你不能在此地图使用它! ");
		}
	else
	{
		player->GetSession()->SendAreaTriggerMessage(" 你不能在当前状态使用它! ");
		return true;
	}
}  

void SendDefaultMenu_ItemUse_flying_mount(Player *player, Item *_Item, uint32 action ,SpellCastTargets const& targets)
{
	switch(action) {
		//【普通陆地坐骑】
		case GOSSIP_ACTION_INFO_DEF + 1 :
		player->ADD_GOSSIP_ITEM( 0, " ·达人幽灵虎 " , 2, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM( 0, " ·达人祖安虎 " , 2, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 2, GOSSIP_ACTION_INFO_DEF + 99);
		player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
		break;
		//【高级陆地坐骑】
		case GOSSIP_ACTION_INFO_DEF + 2 :
		player->ADD_GOSSIP_ITEM( 0, " ·达人超级乌鸦 " , 3, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM( 0, " ·达人超级战熊 " , 3, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 3, GOSSIP_ACTION_INFO_DEF + 99);
		player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
		break;
		//【特殊坐骑】
		case GOSSIP_ACTION_INFO_DEF + 3 :
		player->ADD_GOSSIP_ITEM( 0, " ·达人多彩龙 " , 4, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM( 0, " ·达人其拉虫 " , 4, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 4, GOSSIP_ACTION_INFO_DEF + 99);
		player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
		break;
		//【高级飞行坐骑】
		case GOSSIP_ACTION_INFO_DEF + 4 :
		player->ADD_GOSSIP_ITEM( 0, " ·达人虚空龙 " , 5, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM( 0, " ·达人大凤凰 " , 5, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 5, GOSSIP_ACTION_INFO_DEF + 99);
		player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
		break;
		//【特殊最新坐骑】
	    case GOSSIP_ACTION_INFO_DEF + 5 :
		player->ADD_GOSSIP_ITEM( 0, " ·达人战斗机 " , 6, GOSSIP_ACTION_INFO_DEF + 1);
		player->ADD_GOSSIP_ITEM( 0, " ·达人魔扫帚 " , 6, GOSSIP_ACTION_INFO_DEF + 2);
		player->ADD_GOSSIP_ITEM( 7, "·返回上一级菜单 ", 6, GOSSIP_ACTION_INFO_DEF + 99);
		player->SEND_GOSSIP_MENU(999999,_Item->GetGUID());
		break;
	}

}

bool GossipSelect_ItemUse_flying_mount(Player *player, Item *_Item, uint32 sender, uint32 action ,SpellCastTargets const& targets)
{
	int icount = 0;
	//uint32 price_city;
	switch(sender) {
		// 主选单
	  case 1 :
		  SendDefaultMenu_ItemUse_flying_mount(player, _Item, action,targets);
		  break;
	  case 2 ://普通陆地坐骑
		  switch(action) {
	           case GOSSIP_ACTION_INFO_DEF + 1 :
				   if (!player->IsMounted()) //判断是否在飞行状态
			       {
		            player->FlyingMount(player,42777);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			       }
			       else
			       {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单
			       }
	           case GOSSIP_ACTION_INFO_DEF + 2 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			        {
		            player->FlyingMount(player,24252);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			        }
			       else
			        {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
			        }
					break;
				case GOSSIP_ACTION_INFO_DEF + 99 :
					{
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
					break;
			        }
	 		  }
			  break;
	  case 3 ://高级陆地坐骑
		  switch(action) {
	           case GOSSIP_ACTION_INFO_DEF + 1 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			       {
		            player->FlyingMount(player,41252);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			       }
			       else
			       {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单
			       }
	           case GOSSIP_ACTION_INFO_DEF + 2 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			        {
		            player->FlyingMount(player,43688);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			        }
			       else
			        {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
			        }
					break;
				case GOSSIP_ACTION_INFO_DEF + 99 :
					{
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
					break;
			        }
	 		  }
			  break;
	  case 4 ://普通飞行坐骑
		  switch(action) {
	           case GOSSIP_ACTION_INFO_DEF + 1 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			       {
		            player->FlyingMount(player,24576);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			       }
			       else
			       {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单
			       }
	           case GOSSIP_ACTION_INFO_DEF + 2 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			        {
		            player->FlyingMount(player,31700);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			        }
			       else
			        {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
			        }
					break;
				case GOSSIP_ACTION_INFO_DEF + 99 :
					{
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
					break;
			        }
	 		  }
			  break;
	   case 5 ://高级飞行坐骑
		  switch(action) {
	           case GOSSIP_ACTION_INFO_DEF + 1 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			       {
		            player->FlyingMount(player,37015);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			       }
			       else
			       {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单
			       }
	           case GOSSIP_ACTION_INFO_DEF + 2 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			        {
		            player->FlyingMount(player,32345);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			        }
			       else
			        {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
			        }
					break;
				case GOSSIP_ACTION_INFO_DEF + 99 :
					{
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
					break;
			        }
	 		  }
			  break;
	   case 6 ://特殊最新坐骑
		  switch(action) {
	           case GOSSIP_ACTION_INFO_DEF + 1 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			       {
		            player->FlyingMount(player,44151);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			       }
			       else
			       {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets); //返回菜单
			       }
	           case GOSSIP_ACTION_INFO_DEF + 2 :
		            if (!player->IsMounted()) //判断是否在飞行状态
			        {
		            player->FlyingMount(player,42683);
					player->CLOSE_GOSSIP_MENU();
		            break;   //执行飞行命令
			        }
			       else
			        {
				    player->GetSession()->SendAreaTriggerMessage(" 你正在骑乘状态 ");
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
			        }
					break;
				case GOSSIP_ACTION_INFO_DEF + 99 :
					{
				    GossipHello_ItemUse_flying_mount(player,_Item,targets);//返回菜单
					break;
			        }
	 		  }
			  break;
  }
  return true;
}
void AddSC_flying_mount()
{
    Script *newscript;

    newscript = new Script;
    newscript->Name="flying_mount";
	newscript->pItemUse = GossipHello_ItemUse_flying_mount;
    newscript->pGossipSelect_Item = GossipSelect_ItemUse_flying_mount;
    m_scripts[nrscripts++] = newscript;
}
